package com.framework.loippi.controller.api;

import com.framework.loippi.api.utils.ApiUtils;
import com.framework.loippi.entity.Pathology;
import com.framework.loippi.service.PathologyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller("apiPathologyController")
@Api(tags = {"病理知识信息"})
@RequestMapping(value = "/api/pathology")
public class PathologyController extends ApiBaseController {

    @Resource
    PathologyService pathologyService;

    @RequestMapping(value = "findAll.json", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @ApiOperation(value = "获取所有病理知识")
    public @ResponseBody
    String findAll() {

        List<Pathology> list = pathologyService.findAll();
        return ApiUtils.success(list);
    }

    @RequestMapping(value = "findById.json", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    @ApiOperation(value = "根据id获取病理知识详情")
    public @ResponseBody
    String findById(Long pathologyId) {

        Pathology pathology = pathologyService.find(pathologyId);
        return ApiUtils.success(pathology);
    }
}
